<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 模板消息发送日志
 */
class CreateWxTemplatemsgLog extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wx_templatemsg_logs', function (Blueprint $table) {
            $table->increments('id')->comment('序号');
            $table->string('template_key', 20)->default('')->comment('模板KEY');
            $table->string('msgid', 20)->default('')->comment('消息id');
            $table->string('touser', 60)->default('')->comment('接收者openid');
            $table->string('template_id', 60)->default('')->comment('模板ID');
            $table->mediumText('content')->comment('内容');
            $table->unsignedInteger('errcode')->default(0)->comment('调用接口状态');
            $table->string('errmsg', 30)->default('')->comment('调用接口返回信息');
            $table->string('send_status', 50)->default('')->comment('发送结果');
            $table->timestamps();
            $table->index('msgid', 'index1');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_templatemsg_logs');
    }
}
